﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace GraphViewer.Configuration
{
    public class ConfigurationCollection<T> : ConfigurationElementCollection where T : BaseConfigurationElement
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return System.Activator.CreateInstance<T>();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((T)element).Name;
        }

        public T this[int index]
        {
            get
            {
                return (T)BaseGet(index);
            }
        }

        public new T this[string name]
        {
            get
            {
                return (T)BaseGet(name);
            }
        }
    }
}
